package eu.opensepa.lab.ouranos.model;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="PAYMENT")
public class Payment extends BaseEntity {

	@ManyToOne(optional=false, cascade=CascadeType.ALL)
	@JoinColumn(name="DTR_ACC_ID")
	private Account dtrAcc;

	@ManyToOne(optional=false, cascade=CascadeType.ALL)
	@JoinColumn(name="CRD_ACC_ID")
	private Account crdAcc;

	@Embedded
	private Amount amt;
	
	@Embedded
	private Settlement sttlmt;
	
	@Embedded
	@AttributeOverrides({
		@AttributeOverride(name="sttlmtDt", column=@Column(name="STTLMT2_DT")),
		@AttributeOverride(name="amt.ccy", column=@Column(name="STTLMT2_CCY", length=3)),
		@AttributeOverride(name="amt.val", column=@Column(name="STTLMT2_VAL", precision=12, scale=2))
	})
	private Settlement sttlmt2;
	
	public Account getDtrAcc() {
		return dtrAcc;
	}

	public void setDtrAcc(Account dtrAcc) {
		this.dtrAcc = dtrAcc;
	}

	public Account getCrdAcc() {
		return crdAcc;
	}

	public void setCrdAcc(Account crdAcc) {
		this.crdAcc = crdAcc;
	}

	public Amount getAmt() {
		return amt;
	}

	public void setAmt(Amount amt) {
		this.amt = amt;
	}

	public Settlement getSttlmt() {
		return sttlmt;
	}

	public void setSttlmt(Settlement sttlmt) {
		this.sttlmt = sttlmt;
	}

	public Settlement getSttlmt2() {
		return sttlmt2;
	}

	public void setSttlmt2(Settlement sttlmt2) {
		this.sttlmt2 = sttlmt2;
	}
	
}
